<?php

/**
 * Contact form base class.
 *
 * @package    elearning
 * @subpackage form
 * @author     Your name here
 */
class BaseContactForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'contact_category_id' => new sfWidgetFormPropelChoice(array('model' => 'ContactCategory', 'add_empty' => false)),
      'fullname'            => new sfWidgetFormInput(),
      'tel'                 => new sfWidgetFormInput(),
      'email'               => new sfWidgetFormInput(),
      'subject'             => new sfWidgetFormInput(),
      'message'             => new sfWidgetFormTextarea(),
      'is_activated'        => new sfWidgetFormInput(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorPropelChoice(array('model' => 'Contact', 'column' => 'id', 'required' => false)),
      'contact_category_id' => new sfValidatorPropelChoice(array('model' => 'ContactCategory', 'column' => 'id')),
      'fullname'            => new sfValidatorString(array('max_length' => 255)),
      'tel'                 => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'email'               => new sfValidatorString(array('max_length' => 100)),
      'subject'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'message'             => new sfValidatorString(),
      'is_activated'        => new sfValidatorInteger(array('required' => false)),
      'created_at'          => new sfValidatorDateTime(array('required' => false)),
      'updated_at'          => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('contact[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contact';
  }


}
